// @ts-nocheck
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

// 登录验证
export default new Vuex.Store({
  state: {
    islogin: sessionStorage.getItem('islogin')||localStorage.getItem('islogin'),
    // isLogin: sessionStorage.getItem('isLogin'),
    // aname: sessionStorage.getItem('aname'),
    username:sessionStorage.getItem('username')||localStorage.getItem('username')
  },
  mutations: {
      loginok(state,username){
        state.islogin = true;
        state.username=username
      },
      exit(state){
        state.islogin = false;
        state.username=""
        sessionStorage.clear()  
        localStorage.clear()  
      },
      // 登录
      // login(state, username) {
      //     state.isLogin = true;         
      //     state.aname=username
      //   //   localStorage.setItem("userInfo", true);
      // },
      // 退出
      // logout(state) {
      //     state.isLogin = false          
      //     state.aname=""
      //     sessionStorage.setItem("isLogin","")
      //   //   localStorage.setItem("userInfo", "");
      // }
  }
})




